//获取订单列表
export const getOrderListApi = async () => {
	const {
		data: res
	} = await uni.$http.post('/api/orderInfo/findListByPage', {
		"pageNum": 1,
		"pageSize": 10
	})
	return res
}

//团购查询当前用户当天购买该商品的数量
export const getqueryNumByUserCodeApi = async (uniqueIds) => {
	const {
		data: res
	} = await uni.$http.post('/api/orderInfo/queryNumByUserCode/', uniqueIds)
	return res
}

//查询模块分类
export const getClassApi = async (enterpriseCode, type) => {
	const {
		data: res
	} = await uni.$http.post('/api/miniApp/design/queryListByCondition', {
		enterpriseCode,
		//状态 0-审核中 1-通过 2-未通过
		status: '1',
		// 配置类型1-首页2-我的
		type,
		// 门店是否可见0-可见1-不可见
		visible: 0
	})
	return res
}

//查询商品列表
export const getGoodsListApi = async (data) => {
	//isGroupBuying:0 查询团购
	const {
		data: res
	} = await uni.$http.post('/api/product/querySaleListByPage', data)
	return res
}

// 查询服务商品列表 
export const getServerGoodsListApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post('/api/product/findListByPage', data)
	return res
}

//查询团购商品列表
export const getGroupGoodsListApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post('/api/commodityInfo/queryAllNetListByPage', data)
	return res
}

//查询商品详情
export const getGoodsDetailApi = async (productCode, enterpriseCode) => {
	const {
		data: res
	} = await uni.$http.get('/api/product/getDetail', {
		productCode,
		enterpriseCode
	})
	return res
}
//查询服务商品详情
export const pcGetDetailApi = async (productCode) => {
	const {
		data: res
	} = await uni.$http.get(`/api/product/pcGetDetail?productCode=${productCode}`)
	return res
}

// 查询团购商品详情/api​/product​/queryGroupProduct​/{activityCode}​/{productCode}
export const queryGroupProduct = async (activityCode, productCode) => {
	const {
		data: res
	} = await uni.$http.get(`/api/product/queryGroupProduct/${activityCode}/${productCode}`)
	return res
}

// 查询团购商品列表/api​/product​/queryGroupProduct​
export const queryGroupProductList = async (data) => {
	const {
		data: res
	} = await uni.$http.post(`/api/product/queryGroupProduct`, data)
	return res
}

// 根据uniqueid查询商品详情
export const getUniqueIdDetailApi = async (uniqueId) => {
	const {
		data: res
	} = await uni.$http.get('/api/commodityInfo/queryDetailByCommodityId', {
		commodityId: uniqueId
	})
	return res
}

//删除购物车商品
export const delGoodApi = async (id) => {
	const {
		data: res
	} = await uni.$http.delete(`/api/wxCart/deleteCart/${id}`)
	return res
}

//查询商品分类
export const getGoodsClassApi = async () => {
	const {
		data: res
	} = await uni.$http.get('/api/medicineCategory/getMallCategoryByProject')
	return res
}

//查询所有商品分类
export const getGoodsCateApi = async () => {
	const {
		data: res
	} = await uni.$http.get('/api/medicineCategory/getCategoryByProject')
	return res
}


//新增关注门店
export const addAttentionApi = async (enterpriseCode) => {
	const {
		data: res
	} = await uni.$http.post(`/api/miniApp/bindingStore/${enterpriseCode}`)
	return res
}

//小程序用户取消绑定门店关系 
export const delAttentionApi = async (enterpriseCode) => {
	const {
		data: res
	} = await uni.$http.post(`/api/miniApp/cancelStore/${enterpriseCode}`)
	return res
}

//查询所有团购营销商品
export const getMarketingGoodsApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post('/api/commodityGroupMarketing/miniApp/findListByPage', data)
	return res
}

//分页查询首页配置下的所有商品
export const getDeployGoodsApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post('/api/miniApp/design/queryCommodityListByCondition', data)
	return res
}

//查询商品规格属性价格
export const getattrPriceApi = async (skuId, enterpriseCode, uniqueId) => {
	const {
		data: res
	} = await uni.$http.get(
		`/api/attr/queryPrice/${enterpriseCode}/${uniqueId}?skuId=${skuId}`)
	return res
}

//商品分享链条
export const getspreadLinkApi = async (data) => {
	const {
		data: res
	} = await uni.$http.post('/api/goods/spreadLink/add', data)
	return res
}

// 获取所有团长信息
export const getAllGroupEnterprise = async () => {
	const {
		data: res
	} = await uni.$http.post('/api/enterprise/queryAllGroupEnterprise')
	return res
}